//
//  SvUDIDTools.h
//  EMMApp
//
//  Created by QuDavid on 15/9/11.
//  Copyright (c) 2015年 XJH.COM. All rights reserved.
//

#import <Foundation/Foundation.h>

#define version_str @"ver_1.0.16"

@interface NSDictionary(MyExtend)
- (id)objectAtPath:(NSString *)path;
@end

@interface IDTools : NSObject

+ (void)clearLocalCart;
+ (void)removeLocalCart:(NSArray *) goodsIds;
+ (void)addToLocalCart:(NSString *) goodsId qty:(NSString *) mqty;
+ (void)addToLocalCart:(NSString *) goodsId qty:(NSString *) mqty oldGoodsId:(NSString *) oldGoodsId;

+ (NSMutableDictionary *)getLocalCart;

+ (NSString *)getLocalCartCount;

+ (BOOL)isLogin;


+ (void)logout;

+ (NSString *)dateToQueryString2:(NSDate *)date;

+ (NSString *)getJson:(NSString *)jsonString baseKey:(NSString *)baseKey;

+ (NSString *)idString;

+ (NSString *)idString2;

+ (NSString *)deviceToken;

+ (NSString *)apiUrl;

+ (NSString *)firstSetupDate;

+ (NSString *)dateToQueryString:(NSDate *)date;

+ (NSString *)dateToString:(NSDate *)date;

+ (NSDate *)dateFromString2:(NSString *)date;

+ (NSDate *)dateFromString:(NSString *)date;

+ (NSString *)devId;

+ (NSString *)devId2;

+ (NSString *)uuid;

+ (NSInteger)timeout;

+ (void)setup;

+ (NSDate *)getTheDate:(NSDate *)theDate numMonth:(NSInteger)num;

+ (NSDictionary *)jsonStringToDict:(NSString *)aStr;

+ (NSArray *)jsonStringToArray:(NSString *)aStr;

+ (id)jsonStrToObjc:(NSString *)jsonStr method:(NSString *)method;

+ (NSString *)getIPAddress;

+ (void)setValueStr:(NSString *)valstr keyStr:(NSString *)keystr;

+ (NSString *)getShopItemHtml5:(NSString *)bodystr;

+ (NSString *)objc2json:(id)object;

+ (id)json2objc:(NSString *)aStr;

+ (UIButton *)creatButtonWithFrame:(CGRect)frame
                            target:(id)target
                               sel:(SEL)sel
                               tag:(NSInteger)tag
                             image:(NSString *)name
                             title:(NSString *)title;

/**
 *  允许中文和字母
 *
 *  @param string
 *
 *  @return
 */
+ (BOOL)checkName:(NSString *)string;

/**
 *  检查是否是数字和小数点
 *
 *  @param string
 *  @param text
 *
 *  @return
 */
+ (BOOL)checkNumber:(NSString *)string WithTextFieldText:(NSString*)text;

/**
 *  检查匹配由数字和26个英文字母组成的字符串
 *
 *  @param string
 *
 *  @return
 */
+ (BOOL)checkStringNumbersWithlettersWithString:(NSString*)string;

/**
 *  检查含有数字标点
 *
 *  @param string
 *
 *  @return
 */
+ (BOOL)checkShuZiWithBiaoDianWithString:(NSString*)string;

+ (BOOL)isEmptyString:(NSString *)string;

+ (NSString *)trimEmpty:(NSString *)string;

+ (NSString *)getShopItemHtml5_pc:(NSString *)bodystr;

+ (NSString *)stringByTrimming:(NSString *)string;

+ (NSString *)userNameStringByTrimming:(NSString *)string;

+ (BOOL)isContainsEmoji:(NSString *)string;

+ (BOOL)isEmojiKeyboard:(UITextField *)textField string:(NSString *)string;

+ (BOOL)isValidEmojiString:(NSString *)string;

+ (double)notRounding:(double)price dis:(double)dis;


#pragma mark - 金额的精确运算算法：加减乘除（重要）

+ (NSDecimalNumber *)vg_decimalNumberWithString:(NSString *)value1;

+ (NSString *)vg_decimalNumberMutiplyWithString:(NSString *)multiplierValue value2:(NSString *)multiplicandValue;

+ (NSString *)vg_decimalNumberSubtractingWithString:(NSString *)value1 value2:(NSString *)value2;

+ (NSString *)vg_decimalNumberDividingWithString:(NSString *)value1 value2:(NSString *)value2;

+ (NSString *)vg_decimalNumberAddingWithString:(NSString *)value1 value2:(NSString *)value2;

#pragma mark - 动态计算行高
+ (CGFloat)textHeightFromTextString:(NSString *)text width:(CGFloat)textWidth fontSize:(CGFloat)textSiz;
@end
